//
//  XLAppMacro.h
//  XLBaseModule
//
//  Created by 于鹏 on 2017/8/8.
//  Copyright © 2017年 YIVIEW. All rights reserved.
//  项目所需的宏定义

#ifndef XLAppMacro_h
#define XLAppMacro_h

#import "XLColorMacro.h"
#import "XLNotificationMacro.h"


//日志
#ifdef DEBUG
#define MyString [NSString stringWithFormat:@"%s", __PRETTY_FUNCTION__].lastPathComponent
#define XLLog(...) printf("%s [Line %d] %s\n\n",[MyString UTF8String], __LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String])
#else
#define XLLog(...)
#endif

//判断NSString是否为nil或者为null
#define ISNILORNULL(str) ([str isKindOfClass:[NSNull class]] || str == nil)?@"":str
//tag基础值
#define kXLBasicTag 1000
//设置自定义bundle
#define kXLBundle [NSBundle bundleForClass:[self class]]

//判断手机适配条件(尺寸和系统版本)
#define IOS8_OR_ABOVE ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
#define IOS7_OR_ABOVE ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
#define IOS6_OR_BELOW ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0)

//屏幕尺寸
#define KScreenHeight ([[UIScreen mainScreen] bounds].size.height)
#define KScreenWidth  ([[UIScreen mainScreen] bounds].size.width)
#define KNAV_H 64
#define KTAB_H 49
#define KREAL_H (KScreenHeight - KNAV_H)

#define ISSCREENWIDTH_320   (KScreenWidth == 320)

#define IS_3_5_SIZE (KScreenWidth == 320 && KScreenHeight == 480)
#define IS_4_0_SIZE (KScreenWidth == 320 && KScreenHeight == 568)
#define IS_4_7_SIZE (KScreenWidth == 375 && KScreenHeight == 667)
#define IS_5_5_SIZE (KScreenWidth == 414 && KScreenHeight == 736)
#define IS_9_7_SIZE (KScreenWidth == 768 && KScreenHeight == 1024)
//#define IS_12_9_SIZE (KScreenWidth == 414 && KScreenHeight == 736)



//自适应高度和宽度
#define ADAPT_HEIGHT (KScreenHeight - 480)
#define ADAPT_WIDTH (KScreenWidth - 320)
#define HEIGHT_RATIO_6 (KScreenHeight / 667)
#define WIDTH_RATIO_6 (KScreenWidth / 475)

//比例数
#define RATIO_H(number) number*HEIGHT_RATIO_6
#define RATIO_W(number) number*WIDTH_RATIO_6

//tableView分割线高度
#define kXLSeperateLineHeight 1.0f

//字体
//自适应字体大小 4.7寸(4.7以下用一套字体 5.5乘以1.5)
//#define kXLSizeScale (KScreenHeight > 667 ? 1.5 : 1)
//#define XLFONT(x) [UIFont systemFontOf    Size:x * kXLSizeScale]
#define XLFONT(x) [UIFont systemFontOfSize:x]

#define kXLDefaultFontSize XLFONT(15)          //正常文字大小
#define kXLDetailFontSize XLFONT(13)           //描述文字大小
//弱引用、强引用
#define XLWeakSelf(type)  __weak typeof(type) weak##type = type
#define XLStrongSelf(type)  __strong typeof(type) type = weak##type

//沙盒路径
#define PATH_OF_APP_HOME    NSHomeDirectory()
#define PATH_OF_TEMP        NSTemporaryDirectory()
#define PATH_OF_DOCUMENT    [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]

//#define LOGIN_STR @"用户令牌失效,请重新登陆!"
#define LOGIN_STR @"用户令牌失效"


#endif /* XLAppMacro_h */
